import { request } from '@/utils/request'
export default ({
    
    getToken() {
        let data = {
            appKey: "ding8n0tcqjvc0veclgs",
            appSecret: "dpTt0m4HOtwDcjlkfTgXLTn36HEJfxND0zPaeKYWULxKnfDHkmPLKnOgf28pJkZV"
        }
        return request("/cmeduGateway/cmeduweb00001/v1/getToken", "post", data)

    },
    //获得用户组织
    getOrganizations() {
        return request("/sign/department/get/all", "GET")
    },
    getUserList(data) {
        return request(`/sign/department/getDeptUser` , 'get', data);
    },
    getRole() {
        return request(`/sign/department/get/all/role`, "GET");
    },
    //jwDictData/DictionariesInfo获取组织分类
    getDictionariesInfo(){
        return request(`/sign/jwDictData/DictionariesInfo`, "GET");
    },
    getRoleByAddDeptUser(){
        return request("/sign/department/get/role")
    },
    addDeptUser(data){
        return request("/sign/department/addDeptUserOrg",'post',data)
    },
    getSchoolListt(data) {
        return request('/cmeduApi/cmeduweb00001/v1/cmeduweb00001_bm_230418001/query', "GET", data);
    },
    //增加班级
    addClass(data){
        return request('/sign/jwClbum/addClbum','post',data)
    },
    //获取学校所有班级
    getClassInfoBySchool(data){
        return request('/sign/jwClbum/queryByPage','get',data)
    },
    //获取所有学校
    getSchoolList(data){
        return request('/sign/jwSchoolinfo/getSchoolShowList','get',data)
    },
    //删除班级
    delClass(schoolCode){
        return request('/sign/jwClbum/delete/'+schoolCode,'post')
    },
    //年级分类
    getClassType(){
        return request("/sign/jwDictData/getDictionariesGrade",'get')
    },
    getOneSelect() {
        return request('/cmeduApi/cmeduweb00001/v1/cmeduweb00001_bm_230418003/query', "GET");
    },
    getTwoSelect() {
        return request('/cmeduApi/cmeduweb00001/v1/cmeduweb00001_bm_230418002/query', 'GET');
    },
    getAllTeacher(data) {
        return request('/cmeduApi/cmeduweb00001/v1/cmeduweb00001_bm_230418004/lists', 'GET', data)
    },
    getChildrenInfo(data) {
        return request('/sign/department/getChildren?orgId=' + data, 'GET', data)
    },
    setDeptZg(data) {
        return request('/sign/department/setDeptAdmin', 'post', data)
    },
    getConditionChildrenInfo(data){
        return request('/sign/department/getChildren?orgId='+ data.orgId+'&name='+data.name+'&status='+data.status+'&enable='+data.enable, 'get')
    },
    getUserByOrgId(data) {
        return request('/sign/department/getDeptUser?orgId=' + data, 'get')
    },
    getZgByOrgId(data) {
        return request('/sign/department/getDeptMainUser?orgId=' + data, 'get')
    },
    //组织中添加成员
    addUserByOrg(data) {
        return request('/sign/department/addDeptUser', 'post', data)
    },
    //添加组织
    addOrg(data) {
        return request('/sign/departmentUserRole/saveDept', 'post', data)
    },
    //修改组织
    updateOrg(data) {
        return request('/sign/department/updateDept', 'post', data)
    },
    //删除组织
    delOrg(data) {
        return request('/sign/department/delDept?orgId=' + data, 'post')
    },
    //修改用户
    updateUser(data) {
        return request('/sign/department/updateUser','post', data)
    },
    //删除用户
    delUser(data){
        return request('/sign/department/delUser?userId='+data,'post')
    },
    //获取所有菜单
    getMenu(){
        return request("/sign/mxkMenu/getMenuInfo",'get')
    },
    getDeptInfo(id){
        return request("/sign/department/getDeptInfoById?id="+id,'get')
    },
    //获取单个部门的菜单
    getMenuByRole(id){
        return request("/sign/mxkMenu/getRoleMenuInfo?roleId="+id,'get')
    },
    //成员管理搜索
    cySelect(data){
        return request('/sign/department/getDeptUserByName?name='+data,'get')
    },
    //获取用户数据
    getUser(data){
        return request('/sign/RoleMenu/getUser','post',data)
    },
    //获取当前部门用户
    getDeptUser(data){
        return request('/sign/department/selectUserByRole','get',data)
    },
    //获取角色的用户信息
    getUserByRole(id){
        return request('/sign/RoleMenu/getRoleUser?roleId='+id,'get')
    },
    getNodeData() {
        return request("/sign/department/get/all", "GET")
    },
    //绑定菜单
    bindMenu(data){
        return request("/sign/RoleMenu/addRoleMenu", "post",data)
    },
    //绑定用户
    bindUser(data){
        return request("/sign/RoleMenu/addRoleUser", "post",data)
    },
    //增加角色
    addRole(data){
        return request("/sign/RoleMenu/saveOrUpdateRole","post",data)
    },
    //删除角色
    delRole(id){
        return request("/sign/RoleMenu/delRole/"+id,"post")
    },
    //根据班级获取教职工
    getTeacherByClass(data){
        return request('/cmeduApi/cmeduweb00001/getTeacherByClass',"GET",data)
    },
    //根据班级获取学生
    getStudentByClass(data){
        return request('/cmeduApi/cmeduweb00001/getStudentByClass',"GET",data)
    },
    //获取当前用户角色
    getRoleByUser(){
        return request("/sign/departmentUserRole/deptCodeRole","post")
    },
    getDeptAuthority(id){
        return request("/sign/department/authenticateOrg?orgId="+id,"get")
    },
    delDeptUser(data){
        return request("/sign/department/delDeptUser","post",data)
    },
    //修改班级
    updateClass(data){
        return request("/sign/jwClbum/editClbum",'post',data)
    },
    //获取当前角色下的所有用户
    getUserByRoles(data){
        return request("/sign/RoleMenu/getRoleUser",'GET',data)
    },
    removeUserByRole(data){
        return request("/sign/RoleMenu/delRoleUserById",'post',data)
    },
    async getDingTree(data) {
        let info = await this.getToken();
        data.token = info.data.accessToken;
        return request("/sign/department/getDingTree", "post",data)
    },
    async removeCache() {
        return request("/sign/department/removeCache", "post")
    }
   
})
